package com.example.demo.mapper;
import com.example.demo.entity.*;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.transaction.annotation.Transactional;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import java.util.List;

public interface BookMapper {

    @Select("select * from list")
    List<Book> findAll();
    @Update("insert into list(`name`,`age`,`sex`,`email`,`phone`,`zhiwei`)values(#{name},#{age},#{sex},#{email},#{phone},#{zhiwei})")
    @Transactional
    void add(Book book);




    @Update("UPDATE list SET name = #{name}, age = #{age},sex=#{sex},email=#{email},phone=#{phone},zhiwei=#{zhiwei} WHERE id = #{id}")
    void update(Book book);



    @Update("UPDATE user SET flag = #{flag} WHERE id = #{id}")
    void updateUser(User book);

    @Delete("DELETE FROM list WHERE id = #{id}")
    void deleteById(Book book);

}
